Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO
Imports System.Text
Public Class AppHelper
    Public Shared Function GetXmlDocument(ByRef obj As Object) As XmlDocument
        Dim retval As New XmlDocument
        Dim sb As New StringBuilder
        Dim swWriter As New StringWriter(sb)
        Dim ser As New XmlSerializer(obj.GetType)
        ser.Serialize(swWriter, obj)
        Dim reader As New StringReader(swWriter.ToString)
        Dim dst As New DataSet
        dst.ReadXml(reader)
        retval.LoadXml(dst.GetXml)
        GetXmlDocument = retval
    End Function

End Class
